package org.example.lottery_system.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.*;
import org.example.lottery_system.dao.dataObject.Encrypt;
import org.example.lottery_system.dao.dataObject.UserDO;
import org.example.lottery_system.dao.pojo.UserInfo;

import java.util.List;

@Mapper



public interface UserMapper extends BaseMapper<UserDO> {
    @Select("select email from user where user.email = #{email}")
    public List<String> findEmailByEmail(String email);
    @Select("select count(*) from user where phone_number = #{phoneNumber}")
    int countByPhone(@Param("phoneNumber") Encrypt phoneNumber);
    @Insert("insert into user (user_name, email, phone_number, password, identity) " +
            "values (#{userName}, #{email}, #{phoneNumber}, #{password}, #{identity})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insert(UserDO userDO);
    @Select("select * from user where user.email = #{email}")
    UserDO selectByEmail(String email);
    @Select("select * from user where phone_number = #{phoneNumber}")
    UserDO selectByPhoneNumber(Encrypt phoneNumber);
}
